package p.ithorns.example.statemachine.test;

import lombok.Getter;
import lombok.Setter;
import p.ithorns.example.statemachine.core.Action;
import p.ithorns.example.statemachine.core.State;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

/**
 * FlowState
 * TODO
 *
 * @author ithorns
 * @version 1.0.0
 * @date 2022/11/13 12:24
 */
@Getter
@Setter
public class FlowState implements State {

    private FlowStatus status;

    private List<Action> actions;

    public FlowState() {}

    public  FlowState(FlowStatus status, Action... action) {
        this.status = status;
        this.actions = new ArrayList<>(Arrays.asList(action));
    }

    public void addAction(Action action) {
        this.actions.add(action);
    }


    @Override
    public String toString() {
        return status.getCode();
    }
}